using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Commons;
using Datas;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class QuestionCard : ComMonoBehaviour,IPointerClickHandler
{
    public static bool isSelect;
    // Start is called before the first frame update
    void Start()
    {
        isSelect = false;
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void OnPointerClick(PointerEventData eventData)
    {
        if (eventData.button == PointerEventData.InputButton.Left)
        {
            if (isSelect == false)
            {
                HandCardMgr.SelectQuestionCard(this.gameObject);
                
                SendMsg(MsgData.haveSelectHandCard);
                float x = this.transform.position.x;
                float y = this.transform.position.y;
                gameObject.transform.position = new Vector2(x , y+10);
                isSelect = true;
            }else if (isSelect == true)
            {
                HandCardMgr.CancelSelectQuestionCard(this.gameObject);
                
                SendMsg(MsgData.haveNoSelectHandCard);
                float x = this.transform.position.x;
                float y = this.transform.position.y;
                gameObject.transform.position = new Vector2(x , y-10);
                isSelect = false;
            }
        }
    }
    protected override void OnBeforeDestroy()
    {
        
    }
}

